
export const getTableColumns = (params) => {
  let columns = [{ headerName: 'MBB', field: "MBB", minWidth: 60, flex: 1 }]
  params.forEach(item => {
    columns.push({ headerName: item.dataTime.slice(5), field: item.dataTime.slice(5), minWidth: 40, flex: 1 })
  })
  const temp = ['AST_1D', 'AST_10D', '基准值', '差异']
  const fieldOptions = ['oneDayAst', 'tenDayAst', 'baseTT', 'diftenDayAst']
  let target = []
  params = [{}, ...params]
  fieldOptions.forEach((val, idx) => {
    let pool = {}
    params.forEach((item, index) => {
      let a = columns[index].headerName
      pool[a] = item[val] !== undefined ? item[val] : temp[idx]
      // target.push(
      //   [columns[index].headerName, item[val]]
      // )
    })
    target.push(pool)
  })

  return {
    columns,
    target
  }
}
